package com.simpns.io;

import com.simpns.io.entity.DevReturn;
import lombok.Data;

/**
 * @Description TODO
 * @Author simpns
 * @Date 2024/12/30 11:46
 */
@Data
public class IORet {
    private int retCode;
    private int errorCode;
    private DevReturn devReturns;

    public IORet(int retCode, DevReturn devReturns) {
        this.retCode = retCode;
        this.errorCode = devReturns.iPhyCode;
        this.devReturns = devReturns;
    }

    public boolean isOk() {
        if (retCode != 0 || errorCode != 0 || errorCode != 0) {
            return false;
        }
        return true;
    }

    public String getMessage() {
        return IODevErrorCode.find(errorCode);
    }

    public String getResultDesc() {
        return isOk() ? "成功" : "失败," + getMessage();
    }
}
